package com.jg.xmlSchema2JsonSchema.xsd;

import com.jg.xmlSchema2JsonSchema.xsd.util.XsdUtil;
import org.w3c.dom.Element;

public class XsField {
	private Element element;
	// 节点名称
	private String xpath;
	// 节点描述
	private String annotation;
	private String id;
	public XsField(Element element)
	{
		this.element=element;
		getData();
	}
	private void getData()
	{
		XsAnnotation xsAnnotation= XsdUtil.getAnnotation(element);
		if(xsAnnotation!=null) {
			annotation=xsAnnotation.getText();
		}
		xpath=element.getAttribute("xpath");
		id=element.getAttribute("id");
	}
	
	public String getXpath() {
		return xpath;
	}
	public String getAnnotation()
	{
		return annotation;
	}
	
	public String getId()
	{
		return id;
	}
	public Element getElement()
	{
		return element;
	}

}
